<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="layui/css/layui.css"/>
	</head>
	<body>
		<div class="demoTable">
		  搜索账号：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		  搜索昵称：
		  <div class="layui-inline">
		    <input class="layui-input" name="id" id="demoReload" autocomplete="off">
		  </div>
		  <button class="layui-btn" data-type="reload">搜索</button>
		  <div class="layui-inline">
		                  <input type="text" id="createTimeStart" class="layui-input userName"
		                         name="createTimeStart" placeholder="操作时间(开始)" value="">
		              </div>
		              <div class="layui-inline">
		                  <input type="text" id="createTimeEnd" class="layui-input userName"
		                         name="createTimeEnd" placeholder="操作时间(结束)" value="">
		              </div>
		              <a class="layui-btn search_btn" lay-submit="" data-type="search" lay-filter="search">查询</a>
		</div>
		<table id="user_table" lay-filter="user_table"></table>
		<!-- 表单事件 -->
		<script type="text/html" id="barEdit">
		        <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
		        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
		</script>
		
		<script src="jquery/jquery.min.js"></script>
		<script src="src/layui.js"></script>
		<script>
			layui.use(['table','layer','laydate'],function(){
				var table=layui.table,
				laydate=layui.laydate,
				layer=layui.layer;
				table.render({
					elem:'#user_table',
					url:'./拍卖模块数据.json',
					limits:[5,10,20],
					limit:10,
					page:true,
					cols:[[
						{type:'checkbox'},//开启复选框
						{title:'序号',field:'id',sort:'true'},
						{title:'商品名称',field:'id'},
						{title:'购买数量',field:'birthday'},
						{title:'商品价格',field:'birthday'},
						{title:'卖家账号',field:'email',sort:'true'},
						{title:'买家账号',field:'email',sort:'true'},
						{title:'发货地址',field:'email',sort:'true'},
						{title:'收获地址',field:'email',sort:'true'},
						{title:'支付状态',field:'fullname',sort:'true'},
						
						{title:'支付方式',field:'sex',templet:'#sexTml'},
						{title:'订单号',field:'sex',templet:'#sexTml'},	
						{title:'支付交易号',field:'sex',templet:'#sexTml'},
						{title:'创建时间',field:'id',sort:'true'},
						{title:'更新时间',field:'roleName'},
						{title:'操作',templet:'#barEdit'}
					]],
					parseData:function(result){
						return{
							code:result.code==200?0:result.code(),
							msg:result.message,
							data:result.data.list,
							count:result.data.total
						}
					}
				});
				table.on('tool(user_table)',function(row){
					var event=row.event,
					data=row.data;
					if(event==='edit'){
						layer.open({
							type:2,
							title:'订单编辑页面',
							area:['450PX','560PX'],
							content:'订单信息修改页面.html'
							
						})
					}else if(event==='del'){
						layer.confirm('确定删除吗',function(index){
							$.ajax({
								url:'',
								type:'delete',
								dataType:'json',
								success:function(result){
									if(result.code===200){
										layer.msg('删除成功',{icon:2},function(){
											parent.location.reload();
										})
									}else{
										layer.msg(result.message,{icon:5});
									}
								}
								
							})
						})
					}
					
					
				});
				//日期选择模块js
				var start = laydate.render({
				                elem:'#createTimeStart',
				                max:'new Date()',
				                type:'date',
				                trigger:'click',
				                done:function (value,date) {
				                    end.config.min = date;
				                    end.config.min.month=date.month-1;
				                }
				            })
				
				            var end = laydate.render({
				                elem:'#createTimeEnd',
				                max:'new Date()',
				                type:'date',
				                trigger:'click',
				                done:function (value,date) {
				                    start.config.max = date;
				                    start.config.max.month = date.month-1;
				                }
				            })
					//日期搜索模块js '这里为table的js里的id'
					$(".search_btn").click(function () {
					            table.reload('logList',{
					                page:1,
					                where:{
					                    operate:$("#operation").val(),
					                    begin:$("#createTimeStart").val(),
					                    end:$("#createTimeEnd").val()
					                },
					                parseData:function (result) {
					                    return {
					                        count:result.data.total,
					                        msg:result.message,
					                        data:result.data.list,
					                        code:result.code==200?0:result.code
					                    }
					                }
					            })
					
					        });
			
			})
			
			
		</script>
	</body>
</html>
